﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace Dashboard
{
    public partial class BackupDashboard : Form
    {
        private string BackupFolder = null;
        System.Configuration.Configuration config = null;
        public BackupDashboard()
        {
            InitializeComponent();
            config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            if (BackupFolderChooser.ShowDialog() == DialogResult.OK)
            {
                BackupFolder = BackupFolderChooser.SelectedPath;
                config.AppSettings.Settings["BACKUP_FOLDER"].Value = BackupFolder;
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
            }
        }
    }
}
